#ifndef SOCKETREQUESTHANDLER_H
#define SOCKETREQUESTHANDLER_H

#include <QObject>

class SocketRequestHandler : public QObject
{
    Q_OBJECT
public:
    explicit SocketRequestHandler(QObject *parent = nullptr);
    ~SocketRequestHandler();

signals:
    void resultReady(const QString& result);
    void finished();
public slots:
    void startProcessingRequests();
private:
    std::array<QString, 10> stringArray;
    QQueue<QString> pendingRequests;
    QTcpSocket* tcpSocket;

    void sendRequest(const QString& request);
    void handleResponse();
    void closeConnection();
    void sendNextRequest();
    void socketDisconnected();
};

#endif // SOCKETREQUESTHANDLER_H
